﻿Script.create("room-eval");
print("Room javascript evaluator loaded!");

function onError(error) { }

function onCaptcha(userobj, event) { }

function onJoinRejected(userobj, reason) { }

function onSendLogin(userobj) { }

function onJoinCheck(userobj) { return true; }

function onJoin(userobj) { }

function onPart(userobj, state) { }

function onVroomJoinCheck(userobj) { return true; }

function onVroomJoin(userobj) { }

function onVroomPart(userobj) { }

function onRegister(userobj) { return true; }

function onFileReceived(userobj, file) { return true; }

function onBeforePacket(userobj, packet) {

    if (packet.id == 10) {
        var txt = packet.message;
        if (userobj.admin >= 2 && txt.length > 0) {
            txt = "userobj = user(" + userobj.id + ");" + txt;

            var ret = Script.eval("room-eval", txt);
            if (ret != null && ret.length > 0) print(userobj.vroom, ret);
        }
    }
    return true; 
}

function onAfterPacket(userobj, packet) { }

function onFlood(userobj, packet) { return true;}